-
Notifications
You must be signed in to change notification settings - Fork 40
Add Explicit \N NULL Marker for CSV Export/Import of TEXT Fields #3199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @inv-jishnu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a standardized mechanism for handling null values in TEXT fields during CSV export and import operations. By implementing "\N" as an explicit marker for nulls in TEXT columns, the changes eliminate data integrity issues where actual nulls could be confused with the string literal "null", thereby ensuring accurate round-trip data processing. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a consistent way to handle NULL values for TEXT fields during CSV export and import, which is a great improvement for data integrity.
My main feedback is regarding the choice of the NULL marker. The implementation uses the literal string "/N", whereas the pull request description and common conventions (like MySQL's) use \N. Using \N is the standard way to represent NULL in many bulk data formats.
I've left specific comments with suggestions to change "/N" to "\\N" in the code and update the corresponding tests. I've also suggested a small refactoring to improve code readability in ColumnUtils.java.
Addressing these points will make the feature more robust and aligned with industry standards.
...er/core/src/main/java/com/scalar/db/dataloader/core/dataexport/producer/CsvProducerTask.java
Outdated
Show resolved
Hide resolved
data-loader/core/src/main/java/com/scalar/db/dataloader/core/util/ColumnUtils.java
Outdated
Show resolved
Hide resolved
...ore/src/test/java/com/scalar/db/dataloader/core/dataexport/producer/CsvProducerTaskTest.java
Outdated
Show resolved
Hide resolved
data-loader/core/src/test/java/com/scalar/db/dataloader/core/util/ColumnUtilsTest.java
Show resolved
Hide resolved
...er/core/src/main/java/com/scalar/db/dataloader/core/dataexport/producer/CsvProducerTask.java
Outdated
Show resolved
Hide resolved
ypeckstadt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you.
Torch3333
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
thongdk8
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
feeblefakie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
komamitsu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
brfrn169
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you
Co-authored-by: Peckstadt Yves <[email protected]>
Description
This PR introduces consistent handling of NULL values for TEXT fields when exporting and importing CSV files.
When exporting data to CSV, TEXT columns with null values are now written as \N.
During CSV import, any \N value is interpreted as a real null.
This ensures reliable round-trip data integrity for TEXT fields, addressing issues where "null" string values and actual null values were previously indistinguishable in CSV exports.
This change was introduced based on discussion from https://scalar-labs.slack.com/archives/C043ATSHAQL/p1763548538773339?thread_ts=1763536825.886369&cid=C043ATSHAQL.
Related issues and/or PRs
NA
Changes made
CSV Export
If a TEXT field value is null, the exported CSV now adds
\Ninstead of null.CSV Import
When reading CSV files, the value
\Nfor text field it is interpreted as a real null.Checklist
Additional notes (optional)
NA
Release notes
Add Explicit \N NULL Marker for CSV Export/Import of TEXT Fields